package com.pizza.control;

import java.io.IOException;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.Date;
import java.util.Map;

import javax.el.ELContext;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.component.UIInput;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
import javax.faces.validator.ValidatorException;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.richfaces.component.Dropzone;
import org.richfaces.event.DropEvent;


import com.pizza.abstrait.AbstractPersonnaliser;
import com.pizza.database.IPizzaManager;
import com.pizza.database.PizzaManager;
import com.pizza.database.PizzaManagerClient;
import com.pizza.model.Client;
import com.pizza.model.Adresse;
import com.pizza.model.Ingredient;
import com.sun.faces.util.MessageFactory;
import com.sun.xml.internal.messaging.saaj.soap.MessageImpl;

/**
 * Class PersonnaliserBean
 *
 */
public class PersonnaliserBean extends AbstractPersonnaliser
{
	protected ArrayList<Ingredient> tousLesIngredients;
	protected String init = "";
	private ArrayList<PersonnaliserBean> perso;
	
	public PersonnaliserBean()
	{
		perso = new ArrayList<PersonnaliserBean>();
		perso.add(this);
		try
		{
			tousLesIngredients = PizzaManagerClient.GetPizzaManager().getListTousLesIngredients();
		}catch (RemoteException e)
		{
			e.printStackTrace();
		}
	}
	
	public void processDropAdd( DropEvent event )
	{
		Ingredient ing = (Ingredient)event.getDragValue();
        if(ing == null)
            System.err.print("erreur");
        this.addIngredient(ing);
        
    }
	public void processDropRemove( DropEvent event )
	{
		Ingredient ing = (Ingredient)event.getDragValue();
        if(ing == null)
            System.err.print("erreur");
        this.removeIngredient(ing);
        
    }
	public ArrayList<PersonnaliserBean> getPerso() {
		return perso;
	}

	public void setPerso(ArrayList<PersonnaliserBean> perso) {
		this.perso = perso;
	}


	public ArrayList<Ingredient> getTousLesIngredients() {
		return tousLesIngredients;
	}


	public void setTousLesIngredients(ArrayList<Ingredient> tousLesIngredients) {
		this.tousLesIngredients = tousLesIngredients;
	}

	public String getInit() {
		return init;
	}

	public void setInit(String init) {
		this.init = init;
	}


}
